<%--
 *  File:    FileManage.jsp
 *  @Author: banshang 
 *  Date:    2010/08/03
 *
 *  Copyright (C) 2000 - 2008 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>  

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  String privilegeCode = "E0541";
  String strTableName = "v_initfilemanage";
  String strModuleName = "CM";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>
<%@ include file="/inc/Print.inc"%>
<html>
<head>
<title>FileManage</title>
<PageFlow:CheckPageFlow pageName="p_initfilemanage"/>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>
<%
  Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
  if(totalsummary == null) totalsummary = new Vector();

  HashMap UserInfo = (HashMap)session.getAttribute("userinfo");
  if(UserInfo == null) UserInfo = new HashMap();
  
  String dateFormat = (String) session.getAttribute("dateformat");
 dateFormat = "yyyy-MM-dd";
%>
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>

<script language="JavaScript">
<%--  put your custom script here   --%>
function page_summary(actionvalue,orderbyname)
{
if(!checkForm(document.cform))
    return;
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "FileManage.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
  
}
function clickRow(obj,idx)
{
	var cform = document.cform;
    cform.datafiledetailid.value = eval('obj.all.datafiledetailid'+idx).value;
    cform.filename.value = eval('obj.all.filename'+idx).value;
    cform.filepath.value = eval('obj.all.filepath'+idx).value;
}
function page_save(id){
	var datafiledetail = document.getElementById(id);
	cform.datafiledetailid.value = datafiledetail.value;
    cform.target = "reloadHandler";
    cform.actionname.value = "download";
    isRunning = true;
    cform.submit();
} 
function file_tagdelete(){
	if(isNullChecked(cform.datafile))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }	
	if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE") %>") )  return;
	  cform.actionname.value="tagdelete";
	  isRunning = true;
    cform.submit();
}
function file_uninstall(){
	if(isNullChecked(cform.datafile))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }
	if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE") %>") )  return;
	  cform.actionname.value="uninstall";
	  isRunning = true;
    cform.submit();
}
function allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('datafile');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}

</script>
</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_initfilemanage">
    <input type="hidden" name="actionname">
    <input type="hidden" name="datafiledetailid" value="">
<input type="hidden" name="mark" value="1" /> 
<%--  page location   --%>
    <%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
    <tr>
		<td  style="width:210px">
				<%= label.getLabelName("L_TransType") %><%= label.getLabelName("L_Colon") %>
				<custom:selectdic dictType="DataCleanType" property="datatype" defaultValue="--------" defaultValueCost="" command="notnull" label="L_TransType"/>
		</td>
		<td>
		
				<table>
					<%@ include file="/inc/SummarySearch.inc"%>
				</table>
				
        </td>		
	</tr>
    </table>
    <table width="100%" cellspacing="0" border="0" cellpadding="0">
        <td>
          <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
	            <tr class="deepblue-left">
	              <td width="22" class="title_center"><input type="checkbox" name="allcheck" class="normalradio" onclick="allcheckselect();"></td>
	              <td class="title_center" width="60"><%= label.getLabelName("L_Serial") %></td>
	              <td class="title_center" width="*"><a href="javascript:page_summary('orderby','filename')"><%= label.getLabelName("L_filename") %></a></td>
	              <td class="title_center" width="150"><a href="javascript:page_summary('orderby','status')"><%= label.getLabelName("L_FileStatus") %></a></td>
	              <td class="title_center" width="350"><a href="javascript:page_summary('orderby','customerid')"><%= label.getLabelName("L_Partner") %></a></td>
	              <td class="title_center" width="150"><a href="javascript:page_summary('orderby','createdate')"><%= label.getLabelName("L_CreateTime") %></a></td>
	            </tr>
<%
	int i=0;
	String strClassType="";
%>
            <%--  the old detail lines  --%>
 <span id="olddetail" >
            <logic:iterate id="onerow" collection="<%= totalsummary %>" indexId="idx">
<%
	if(i%2 == 1)
	  {
	    strClassType = "td-listrom";
	  }else{                    
	    strClassType = "none";
	  }
	  i++;
%>
				            <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=strClassType%>'">
				              <td>				               
				                
				                <input type="hidden" id="<%= i %>" value="<custom:write name="onerow" property="datafiledetailid"/>">
				               	<input type="checkbox" name="datafile" value="<custom:write name="onerow" property="datafiledetailid"/>"  class="normalradio">	
				              </td>
				              <td>
				                <%= i %>
				              </td>
				              <td>
<!--				                <a href="javascript:page_save(<%= i %>);"></a>-->
				                <custom:write property="filename" name="onerow" />				               
				                
				              </td>
				              <td>
				                <custom:write property="valuename" name="onerow" nbsp="true"/>
				              </td>
				              <td>
				                <custom:write property="orgname" name="onerow" nbsp="true" />
				              </td>
				              <td>
				                <custom:write property="createdate" name="onerow" nbsp="true"/>
				              </td>
				            </tr>

            </logic:iterate>
</span>

            <%@ include file="/inc/SummaryAction.inc" %>
          </table>
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
              <%--  
                <a onclick="file_tagdelete();"><custom:button type="1" label="L_TagDelete" border="0" style="width:60"/></a>
              --%>
	            <a onclick="file_uninstall();"><custom:button type="1" label="L_Unloading" imgsrc="batchclose.gif" border="0" style="width:60" privilegeCode="MB-WJGL01"/></a>
	          </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
</form>
</body>
</html>